<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<script src="js/jquery-1.8.3.js"></script>
	<script>
		onload = function(){
			$("input:first").click(function(){
				$("input:gt(0)").attr("checked",this.checked);
			});
			$("input:gt(0)").click(function(){
				//判断是否都选中了
				if( $("input:gt(0)").filter(":checked").length == ($("input").length-1) ){
					$("input:first").prop("checked",true);
				} else {
					$("input:first").prop("checked",false);
				}
			});
		}
	</script>
	<body>
		<input type="checkbox" />全选
		<input type="checkbox" />CSS3
		<input type="checkbox" />JAVASCRIPT
		<input type="checkbox" />JAVA
		<input type="checkbox" />PHP
		<input type="checkbox" />C#
		<input type="checkbox" />C++
		<input type="checkbox" />.NET
	</body>
</html>
